Ext.define("ZYY.view.system.employee", {
	extend : "Ext.panel.Panel",
	alias : 'widget.employee',// 别名 xtype用
	title : "人员管理",
	closable : true,
	layout : 'border',
	initComponent : function() {
		Ext.apply(this,{
			items : [{
				xtype : 'deptTree',
				region : 'west'
			}, {
				xtype : 'gridpanel',
				region : 'center',
				tbar : {
					xtype : "toolbar",
					border : true,
					items : [
							{text : "新增", action : 'add', iconCls : "user_add"}, 
							{text : '修改', action : 'edit', disabled : true, iconCls : "user_edit"}, 
							{text : '删除', disabled : true, action : 'delete', iconCls : "user_delete"}, 
							{xtype: 'tbspacer', width: 50 },
							{xtype: 'textfield', name : 'queryParam', vtype:"char", emptyText : '请输入人员名称/编号',enableKeyEvents : true,width : 130}, 
						    {text : '查询', iconCls : 'find',action : 'query' },
						    {text:"刷新",iconCls:"refresh",action:"refresh"}]
				},
				bbar:{
		        	xtype:'pagingtoolbar',
		            pageSize: 20,
		            store: 'system.employee',
		            displayInfo: true,
		            plugins: Ext.create('Ext.ux.ProgressBarPager', {})
		        },
				store : 'system.employee',
				columns : [
				           { hidden:true, dataIndex : 'empid'},
				           { text : "编号", width : 100, dataIndex : 'empno'},
				           { text : "姓名",  width : 150, dataIndex : 'empname'},
				           { text : "性别",  width : 60, dataIndex : 'sex',renderer:SEXRender},
				           { text : "所在部门", flex:1, dataIndex : 'deptname'},
				           { text : "用户组", flex:1, dataIndex : 'groupid'},
				           { text : "状态", width : 60, dataIndex : 'status',renderer:STATUSRender}
				          ],
				selModel : Ext.create('Ext.selection.CheckboxModel', {
			        listeners: {
			            selectionchange: function(sm, selections) {
			            	(Ext.ComponentQuery.query('employee toolbar button[action=delete]')[0]).setDisabled(selections.length == 0);
			            	(Ext.ComponentQuery.query('employee toolbar button[action=edit]')[0]).setDisabled(selections.length != 1);
			            }
			        }
			   }),
				plugins : [{
					ptype : 'rowexpander',
					rowBodyTpl : ["<p style='margin-left:50px;background-color:#FFF8DC'><img src='"+basePath+"{headpic}' width='48' height='48' style='vertical-align: middle;'/><b>联系方式:</b> {tel}&nbsp;&nbsp;&nbsp;&nbsp;<b>身份证号:</b> {idcard}&nbsp;&nbsp;&nbsp;&nbsp;<b>出生日期:</b> {birthday}"
					              +"&nbsp;&nbsp;&nbsp;&nbsp;<b>居住地:</b> {address}    </p>"]
				}]
			}]
		
		
		});
		
		this.callParent(arguments);
	}
});
